import java.util.HashMap;

/**
 * @projectName: com.xiayuanxing.designPattern
 * @className: AddExpression
 * @author: xiayuanxing
 * @description: 加法解释器
 * @date: 2022/1/17 15:56
 * @version: 1.0
 */
public class AddExpression extends SymbolExpression{


    public AddExpression(Expression left, Expression right) {
        super(left, right);
    }

    //处理相加
    //var仍然是{a=10,b=20}
    public int interpreter(HashMap<String, Integer> var) {
        return super.left.interprete(var) + super.right.interprete(var);
    }
}
